home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / gyruss.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  24KB  |  685 lines

  1. /***************************************************************************
  2.  
  3. Gyruss memory map (preliminary)
  4.  
  5. Main processor memory map.
  6. 0000-5fff ROM (6000-7fff diagnostics)
  7. 8000-83ff Color RAM
  8. 8400-87ff Video RAM
  9. 9000-a7ff RAM
  10. a000-a17f \ sprites
  11. a200-a27f /
  12.  
  13. memory mapped ports:
  14.  
  15. read:
  16. c080      IN0
  17. c0a0      IN1
  18. c0c0      IN2
  19. c0e0      DSW0
  20. c000      DSW1
  21. c100      DSW2
  22.  
  23. write:
  24. a000-a1ff  Odd frame spriteram
  25. a200-a3ff  Even frame spriteram
  26. a700       Frame odd or even?
  27. a701       Semaphore system:  tells 6809 to draw queued sprites
  28. a702       Semaphore system:  tells 6809 to queue sprites
  29. c000       watchdog reset
  30. c080       trigger interrupt on audio CPU
  31. c100       command for the audio CPU
  32. c180       interrupt enable
  33. c185       flip screen
  34.  
  35. interrupts:
  36. standard NMI at 0x66
  37.  
  38.  
  39. SOUND BOARD:
  40. 0000-3fff  Audio ROM (4000-5fff diagnostics)
  41. 6000-63ff  Audio RAM
  42. 8000       Read Sound Command
  43.  
  44. I/O:
  45.  
  46. Gyruss has 5 PSGs:
  47. 1)  Control: 0x00    Read: 0x01    Write: 0x02
  48. 2)  Control: 0x04    Read: 0x05    Write: 0x06
  49. 3)  Control: 0x08    Read: 0x09    Write: 0x0a
  50. 4)  Control: 0x0c    Read: 0x0d    Write: 0x0e
  51. 5)  Control: 0x10    Read: 0x11    Write: 0x12
  52.  
  53. and 1 SFX channel controlled by an 8039:
  54. 1)  SoundOn: 0x14    SoundData: 0x18
  55.  
  56. ***************************************************************************/
  57.  
  58. #include "driver.h"
  59. #include "vidhrdw/generic.h"
  60. #include "cpu/i8039/i8039.h"
  61.  
  62.  
  63. /*#define EMULATE_6809*/
  64.  
  65. void konami1_decode_cpu4(void);
  66.  
  67. extern unsigned char *gyruss_spritebank,*gyruss_6809_drawplanet,*gyruss_6809_drawship;
  68. WRITE_HANDLER( gyruss_queuereg_w );
  69. WRITE_HANDLER( gyruss_flipscreen_w );
  70. READ_HANDLER( gyruss_scanline_r );
  71. void gyruss_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  72. void gyruss_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  73. void gyruss_6809_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  74.  
  75.  
  76. READ_HANDLER( gyruss_portA_r );
  77. WRITE_HANDLER( gyruss_filter0_w );
  78. WRITE_HANDLER( gyruss_filter1_w );
  79. WRITE_HANDLER( gyruss_sh_irqtrigger_w );
  80. WRITE_HANDLER( gyruss_i8039_irq_w );
  81.  
  82.  
  83. unsigned char *gyruss_sharedram;
  84.  
  85. READ_HANDLER( gyruss_sharedram_r )
  86. {
  87.     return gyruss_sharedram[offset];
  88. }
  89.  
  90. WRITE_HANDLER( gyruss_sharedram_w )
  91. {
  92.     gyruss_sharedram[offset] = data;
  93. }
  94.  
  95.  
  96.  
  97. static struct MemoryReadAddress readmem[] =
  98. {
  99.     { 0x0000, 0x7fff, MRA_ROM },
  100.     { 0x8000, 0x87ff, MRA_RAM },
  101.     { 0x9000, 0x9fff, MRA_RAM },
  102. #ifdef EMULATE_6809
  103.     { 0xa000, 0xa7ff, gyruss_sharedram_r },
  104. #else
  105.     { 0xa000, 0xa7ff, MRA_RAM },
  106. #endif
  107.     { 0xc000, 0xc000, input_port_4_r },    /* DSW1 */
  108.     { 0xc080, 0xc080, input_port_0_r },    /* IN0 */
  109.     { 0xc0a0, 0xc0a0, input_port_1_r },    /* IN1 */
  110.     { 0xc0c0, 0xc0c0, input_port_2_r },    /* IN2 */
  111.     { 0xc0e0, 0xc0e0, input_port_3_r },    /* DSW0 */
  112.     { 0xc100, 0xc100, input_port_5_r },    /* DSW2 */
  113.     { -1 }    /* end of table */
  114. };
  115.  
  116. static struct MemoryWriteAddress writemem[] =
  117. {
  118.     { 0x0000, 0x7fff, MWA_ROM },                 /* rom space+1        */
  119.     { 0x8000, 0x83ff, colorram_w, &colorram },
  120.     { 0x8400, 0x87ff, videoram_w, &videoram, &videoram_size },
  121.     { 0x9000, 0x9fff, MWA_RAM },
  122. #ifdef EMULATE_6809
  123.     { 0xa000, 0xa7ff, gyruss_sharedram_w, &gyruss_sharedram },
  124. #else
  125.     { 0xa000, 0xa17f, MWA_RAM, &spriteram, &spriteram_size },     /* odd frame spriteram */
  126.     { 0xa200, 0xa37f, MWA_RAM, &spriteram_2 },   /* even frame spriteram */
  127.     { 0xa700, 0xa700, MWA_RAM, &gyruss_spritebank },
  128.     { 0xa701, 0xa701, MWA_NOP },        /* semaphore system   */
  129.     { 0xa702, 0xa702, gyruss_queuereg_w },       /* semaphore system   */
  130.     { 0xa7fc, 0xa7fc, MWA_RAM, &gyruss_6809_drawplanet },
  131.     { 0xa7fd, 0xa7fd, MWA_RAM, &gyruss_6809_drawship },
  132. #endif
  133.     { 0xc000, 0xc000, MWA_NOP },    /* watchdog reset */
  134.     { 0xc080, 0xc080, gyruss_sh_irqtrigger_w },
  135.     { 0xc100, 0xc100, soundlatch_w },         /* command to soundb  */
  136.     { 0xc180, 0xc180, interrupt_enable_w },      /* NMI enable         */
  137.     { 0xc185, 0xc185, gyruss_flipscreen_w },
  138.     { -1 }    /* end of table */
  139. };
  140.  
  141.  
  142.  
  143. static struct MemoryReadAddress sound_readmem[] =
  144. {
  145.     { 0x0000, 0x5fff, MRA_ROM },                 /* rom soundboard     */
  146.     { 0x6000, 0x63ff, MRA_RAM },                 /* ram soundboard     */
  147.     { 0x8000, 0x8000, soundlatch_r },
  148.     { -1 }    /* end of table */
  149. };
  150.  
  151. static struct MemoryWriteAddress sound_writemem[] =
  152. {
  153.     { 0x0000, 0x5fff, MWA_ROM },                 /* rom soundboard     */
  154.     { 0x6000, 0x63ff, MWA_RAM },                 /* ram soundboard     */
  155.     { -1 }    /* end of table */
  156. };
  157.  
  158. static struct IOReadPort sound_readport[] =
  159. {
  160.     { 0x01, 0x01, AY8910_read_port_0_r },
  161.       { 0x05, 0x05, AY8910_read_port_1_r },
  162.     { 0x09, 0x09, AY8910_read_port_2_r },
  163.       { 0x0d, 0x0d, AY8910_read_port_3_r },
  164.       { 0x11, 0x11, AY8910_read_port_4_r },
  165.     { -1 }
  166. };
  167.  
  168. static struct IOWritePort sound_writeport[] =
  169. {
  170.     { 0x00, 0x00, AY8910_control_port_0_w },
  171.     { 0x02, 0x02, AY8910_write_port_0_w },
  172.     { 0x04, 0x04, AY8910_control_port_1_w },
  173.     { 0x06, 0x06, AY8910_write_port_1_w },
  174.     { 0x08, 0x08, AY8910_control_port_2_w },
  175.     { 0x0a, 0x0a, AY8910_write_port_2_w },
  176.     { 0x0c, 0x0c, AY8910_control_port_3_w },
  177.     { 0x0e, 0x0e, AY8910_write_port_3_w },
  178.     { 0x10, 0x10, AY8910_control_port_4_w },
  179.     { 0x12, 0x12, AY8910_write_port_4_w },
  180.     { 0x14, 0x14, gyruss_i8039_irq_w },
  181.     { 0x18, 0x18, soundlatch2_w },
  182.     { -1 }    /* end of table */
  183. };
  184.  
  185.  
  186. #ifdef EMULATE_6809
  187. static struct MemoryReadAddress m6809_readmem[] =
  188. {
  189.     { 0x0000, 0x0000, gyruss_scanline_r },
  190.     { 0x4000, 0x47ff, MRA_RAM },
  191.     { 0x6000, 0x67ff, gyruss_sharedram_r },
  192.     { 0xe000, 0xffff, MRA_ROM },
  193.     { -1 }    /* end of table */
  194. };
  195.  
  196. static struct MemoryWriteAddress m6809_writemem[] =
  197. {
  198.     { 0x2000, 0x2000, interrupt_enable_w },
  199.     { 0x4000, 0x47ff, MWA_RAM },
  200.     { 0x4040, 0x40ff, MWA_RAM, &spriteram, &spriteram_size },
  201.     { 0x6000, 0x67ff, gyruss_sharedram_w },
  202.     { 0xe000, 0xffff, MWA_ROM },
  203.     { -1 }    /* end of table */
  204. };
  205. #endif
  206.  
  207. static struct MemoryReadAddress i8039_readmem[] =
  208. {
  209.     { 0x0000, 0x0fff, MRA_ROM },
  210.     { -1 }    /* end of table */
  211. };
  212.  
  213. static struct MemoryWriteAddress i8039_writemem[] =
  214. {
  215.     { 0x0000, 0x0fff, MWA_ROM },
  216.     { -1 }    /* end of table */
  217. };
  218.  
  219. static struct IOReadPort i8039_readport[] =
  220. {
  221.     { 0x00, 0xff, soundlatch2_r },
  222.     { -1 }
  223. };
  224.  
  225. static struct IOWritePort i8039_writeport[] =
  226. {
  227.     { I8039_p1, I8039_p1, DAC_0_data_w },
  228.     { I8039_p2, I8039_p2, IOWP_NOP },
  229.     { -1 }    /* end of table */
  230. };
  231.  
  232.  
  233.  
  234. INPUT_PORTS_START( gyruss )
  235.     PORT_START    /* IN0 */
  236.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  237.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  238.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  239.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  240.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  241.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  242.  
  243.     PORT_START    /* IN1 */
  244.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  245.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  246.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
  247.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
  248.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  249.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 1p shoot 2 - unused */
  250.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 2p shoot 3 - unused */
  251.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  252.  
  253.     PORT_START    /* IN2 */
  254.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  255.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  256.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
  257.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
  258.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  259.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 2p shoot 2 - unused */
  260.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  261.  
  262.     PORT_START    /* DSW0 */
  263.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  264.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  265.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  266.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  267.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  268.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  269.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  270.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  271.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  272.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  273.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  274.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  275.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  276.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  277.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  278.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  279.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  280.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  281.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  282.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  283.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  284.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  285.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  286.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  287.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  288.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  289.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  290.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  291.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  292.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  293.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  294.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  295.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  296.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  297.  
  298.     PORT_START    /* DSW1 */
  299.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  300.     PORT_DIPSETTING(    0x03, "3" )
  301.     PORT_DIPSETTING(    0x02, "4" )
  302.     PORT_DIPSETTING(    0x01, "5" )
  303.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
  304.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  305.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  306.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  307.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
  308.     PORT_DIPSETTING(    0x08, "30000 60000" )
  309.     PORT_DIPSETTING(    0x00, "40000 70000" )
  310.     PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
  311.     PORT_DIPSETTING(    0x70, "1 (Easiest)" )
  312.     PORT_DIPSETTING(    0x60, "2" )
  313.     PORT_DIPSETTING(    0x50, "3" )
  314.     PORT_DIPSETTING(    0x40, "4" )
  315.     PORT_DIPSETTING(    0x30, "5 (Average)" )
  316.     PORT_DIPSETTING(    0x20, "6" )
  317.     PORT_DIPSETTING(    0x10, "7" )
  318.     PORT_DIPSETTING(    0x00, "8 (Hardest)" )
  319.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  320.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  321.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  322.  
  323.     PORT_START    /* DSW2 */
  324.     PORT_DIPNAME( 0x01, 0x00, "Demo Music" )
  325.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  326.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  327.     /* other bits probably unused */
  328. INPUT_PORTS_END
  329.  
  330. /* This is identical to gyruss except for the bonus that has different
  331.    values */
  332. INPUT_PORTS_START( gyrussce )
  333.     PORT_START    /* IN0 */
  334.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  335.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  336.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  337.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  338.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  339.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  340.  
  341.     PORT_START    /* IN1 */
  342.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY )
  343.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  344.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY )
  345.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY )
  346.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  347.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 1p shoot 2 - unused */
  348.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 2p shoot 3 - unused */
  349.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  350.  
  351.     PORT_START    /* IN2 */
  352.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_2WAY | IPF_COCKTAIL )
  353.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  354.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_2WAY | IPF_COCKTAIL )
  355.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_2WAY | IPF_COCKTAIL )
  356.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  357.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* 2p shoot 2 - unused */
  358.     PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
  359.  
  360.     PORT_START    /* DSW0 */
  361.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) )
  362.     PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
  363.     PORT_DIPSETTING(    0x50, DEF_STR( 3C_1C ) )
  364.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  365.     PORT_DIPSETTING(    0x40, DEF_STR( 3C_2C ) )
  366.     PORT_DIPSETTING(    0x10, DEF_STR( 4C_3C ) )
  367.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  368.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_4C ) )
  369.     PORT_DIPSETTING(    0x70, DEF_STR( 2C_3C ) )
  370.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  371.     PORT_DIPSETTING(    0x60, DEF_STR( 2C_5C ) )
  372.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  373.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  374.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  375.     PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
  376.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
  377.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  378.     PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
  379.     PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
  380.     PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
  381.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  382.     PORT_DIPSETTING(    0x04, DEF_STR( 3C_2C ) )
  383.     PORT_DIPSETTING(    0x01, DEF_STR( 4C_3C ) )
  384.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  385.     PORT_DIPSETTING(    0x03, DEF_STR( 3C_4C ) )
  386.     PORT_DIPSETTING(    0x07, DEF_STR( 2C_3C ) )
  387.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  388.     PORT_DIPSETTING(    0x06, DEF_STR( 2C_5C ) )
  389.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  390.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  391.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  392.     PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
  393.     PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
  394.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  395.  
  396.     PORT_START    /* DSW1 */
  397.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  398.     PORT_DIPSETTING(    0x03, "3" )
  399.     PORT_DIPSETTING(    0x02, "4" )
  400.     PORT_DIPSETTING(    0x01, "5" )
  401.     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "255", IP_KEY_NONE, IP_JOY_NONE )
  402.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
  403.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  404.     PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
  405.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Bonus_Life ) )
  406.     PORT_DIPSETTING(    0x08, "50000 70000" )
  407.     PORT_DIPSETTING(    0x00, "60000 80000" )
  408.     PORT_DIPNAME( 0x70, 0x70, DEF_STR( Difficulty ) )
  409.     PORT_DIPSETTING(    0x70, "1 (Easiest)" )
  410.     PORT_DIPSETTING(    0x60, "2" )
  411.     PORT_DIPSETTING(    0x50, "3" )
  412.     PORT_DIPSETTING(    0x40, "4" )
  413.     PORT_DIPSETTING(    0x30, "5 (Average)" )
  414.     PORT_DIPSETTING(    0x20, "6" )
  415.     PORT_DIPSETTING(    0x10, "7" )
  416.     PORT_DIPSETTING(    0x00, "8 (Hardest)" )
  417.     PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) )
  418.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  419.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  420.  
  421.     PORT_START    /* DSW2 */
  422.     PORT_DIPNAME( 0x01, 0x00, "Demo Music" )
  423.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  424.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  425.     /* other bits probably unused */
  426. INPUT_PORTS_END
  427.  
  428.  
  429. static struct GfxLayout charlayout =
  430. {
  431.     8,8,    /* 8*8 characters */
  432.     512,    /* 512 characters */
  433.     2,    /* 2 bits per pixel */
  434.     { 4, 0 },
  435.     { 0, 1, 2, 3, 8*8+0,8*8+1,8*8+2,8*8+3 },
  436.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  437.     16*8    /* every char takes 16 consecutive bytes */
  438. };
  439. static struct GfxLayout spritelayout1 =
  440. {
  441.     8,16,    /* 16*8 sprites */
  442.     256,    /* 256 sprites */
  443.     4,    /* 4 bits per pixel */
  444.     { 0x4000*8+4, 0x4000*8+0, 4, 0  },
  445.     { 0, 1, 2, 3,  8*8, 8*8+1, 8*8+2, 8*8+3 },
  446.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  447.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  448.     64*8    /* every sprite takes 64 consecutive bytes */
  449. };
  450. static struct GfxLayout spritelayout2 =
  451. {
  452.     16,16,    /* 16*16 sprites */
  453.     256,    /* 256 sprites */
  454.     4,    /* 4 bits per pixel */
  455.     { 0x4000*8+4, 0x4000*8+0, 4, 0  },
  456.     { 0, 1, 2, 3,  8*8, 8*8+1, 8*8+2, 8*8+3,
  457.         16*8+0, 16*8+1, 16*8+2, 16*8+3,  24*8, 24*8+1, 24*8+2, 24*8+3 },
  458.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  459.             32*8, 33*8, 34*8, 35*8, 36*8, 37*8, 38*8, 39*8 },
  460.     64*8    /* every sprite takes 64 consecutive bytes */
  461. };
  462.  
  463.  
  464.  
  465. static struct GfxDecodeInfo gfxdecodeinfo[] =
  466. {
  467.     { REGION_GFX1, 0x0000, &charlayout,       0, 16 },
  468.     { REGION_GFX2, 0x0000, &spritelayout1, 16*4, 16 },    /* upper half */
  469.     { REGION_GFX2, 0x0010, &spritelayout1, 16*4, 16 },    /* lower half */
  470.     { REGION_GFX2, 0x0000, &spritelayout2, 16*4, 16 },
  471.     { -1 } /* end of array */
  472. };
  473.  
  474.  
  475.  
  476. static struct AY8910interface ay8910_interface =
  477. {
  478.     5,    /* 5 chips */
  479.     14318180/8,    /* 1.789772727 MHz */
  480.     { MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(10,MIXER_GAIN_4x,MIXER_PAN_LEFT),
  481.             MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_RIGHT), MIXERG(20,MIXER_GAIN_4x,MIXER_PAN_LEFT) },
  482.     /*  R       L   |   R       R       L */
  483.     /*   effects    |         music       */
  484.     { 0, 0, gyruss_portA_r },
  485.     { 0 },
  486.     { 0 },
  487.     { gyruss_filter0_w, gyruss_filter1_w }
  488. };
  489.  
  490. static struct DACinterface dac_interface =
  491. {
  492.     1,
  493.     { MIXER(50,MIXER_PAN_LEFT) }
  494. };
  495.  
  496.  
  497.  
  498. static struct MachineDriver machine_driver_gyruss =
  499. {
  500.     /* basic machine hardware */
  501.     {
  502.         {
  503.             CPU_Z80,
  504.             3072000,    /* 3.072 Mhz (?) */
  505.             readmem,writemem,0,0,
  506.             nmi_interrupt,1
  507.         },
  508.         {
  509.             CPU_Z80 | CPU_AUDIO_CPU,
  510.             14318180/4,    /* 3.579545 Mhz */
  511.             sound_readmem,sound_writemem,sound_readport,sound_writeport,
  512.             ignore_interrupt,1    /* interrupts are triggered by the main CPU */
  513.         },
  514.         {
  515.             CPU_I8039 | CPU_AUDIO_CPU,
  516.             8000000/15,    /* 8Mhz crystal */
  517.             i8039_readmem,i8039_writemem,i8039_readport,i8039_writeport,
  518.             ignore_interrupt,1
  519.         },
  520. #ifdef EMULATE_6809
  521.         {
  522.             CPU_M6809,
  523.             2000000,        /* 2 Mhz ??? */
  524.             m6809_readmem,m6809_writemem,0,0,
  525.             interrupt,1
  526.         },
  527. #endif
  528.     },
  529.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  530. #ifdef EMULATE_6809
  531.     20,    /* 20 CPU slices per frame - an high value to ensure proper */
  532.             /* synchronization of the CPUs */
  533. #else
  534.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  535. #endif
  536.     0,
  537.  
  538.     /* video hardware */
  539.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  540.     gfxdecodeinfo,
  541.     32,16*4+16*16,
  542.     gyruss_vh_convert_color_prom,
  543.  
  544.     VIDEO_TYPE_RASTER|VIDEO_SUPPORTS_DIRTY,
  545.     0,
  546.     generic_vh_start,
  547.     generic_vh_stop,
  548. #ifndef EMULATE_6809
  549.     gyruss_vh_screenrefresh,
  550. #else
  551.     gyruss_6809_vh_screenrefresh,
  552. #endif
  553.  
  554.     /* sound hardware */
  555.     SOUND_SUPPORTS_STEREO,0,0,0,
  556.     {
  557.         {
  558.             SOUND_AY8910,
  559.             &ay8910_interface
  560.         },
  561.         {
  562.             SOUND_DAC,
  563.             &dac_interface
  564.         }
  565.     }
  566. };
  567.  
  568.  
  569.  
  570. /***************************************************************************
  571.  
  572.   Game driver(s)
  573.  
  574. ***************************************************************************/
  575.  
  576. ROM_START( gyruss )
  577.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  578.     ROM_LOAD( "gyrussk.1",    0x0000, 0x2000, 0xc673b43d )
  579.     ROM_LOAD( "gyrussk.2",    0x2000, 0x2000, 0xa4ec03e4 )
  580.     ROM_LOAD( "gyrussk.3",    0x4000, 0x2000, 0x27454a98 )
  581.     /* the diagnostics ROM would go here */
  582.  
  583.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  584.     ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, 0xf4ae1c17 )
  585.     ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, 0xba498115 )
  586.     /* the diagnostics ROM would go here */
  587.  
  588.     ROM_REGION( 0x1000, REGION_CPU3 )    /* 8039 */
  589.     ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, 0x3f9b5dea )
  590.  
  591.     ROM_REGION( 2*0x10000, REGION_CPU4 )    /* 64k for code + 64k for the decrypted opcodes */
  592.     ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, 0x822bf27e )
  593.  
  594.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  595.     ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, 0x27d8329b )
  596.  
  597.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  598.     ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, 0xc949db10 )
  599.     ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, 0x4f22411a )
  600.     ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, 0x47cd1fbc )
  601.     ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, 0x8e8d388c )
  602.  
  603.     ROM_REGION( 0x0220, REGION_PROMS )
  604.     ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, 0x98782db3 )    /* palette */
  605.     ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, 0x7ed057de )    /* sprite lookup table */
  606.     ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, 0xde823a81 )    /* character lookup table */
  607. ROM_END
  608.  
  609. ROM_START( gyrussce )
  610.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  611.     ROM_LOAD( "gya-1.bin",    0x0000, 0x2000, 0x85f8b7c2 )
  612.     ROM_LOAD( "gya-2.bin",    0x2000, 0x2000, 0x1e1a970f )
  613.     ROM_LOAD( "gya-3.bin",    0x4000, 0x2000, 0xf6dbb33b )
  614.     /* the diagnostics ROM would go here */
  615.  
  616.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  617.     ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, 0xf4ae1c17 )
  618.     ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, 0xba498115 )
  619.     /* the diagnostics ROM would go here */
  620.  
  621.     ROM_REGION( 0x1000, REGION_CPU3 )    /* 8039 */
  622.     ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, 0x3f9b5dea )
  623.  
  624.     ROM_REGION( 2*0x10000, REGION_CPU4 )    /* 64k for code + 64k for the decrypted opcodes */
  625.     ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, 0x822bf27e )
  626.  
  627.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  628.     ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, 0x27d8329b )
  629.  
  630.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  631.     ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, 0xc949db10 )
  632.     ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, 0x4f22411a )
  633.     ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, 0x47cd1fbc )
  634.     ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, 0x8e8d388c )
  635.  
  636.     ROM_REGION( 0x0220, REGION_PROMS )
  637.     ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, 0x98782db3 )    /* palette */
  638.     ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, 0x7ed057de )    /* sprite lookup table */
  639.     ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, 0xde823a81 )    /* character lookup table */
  640. ROM_END
  641.  
  642. ROM_START( venus )
  643.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  644.     ROM_LOAD( "r1",           0x0000, 0x2000, 0xd030abb1 )
  645.     ROM_LOAD( "r2",           0x2000, 0x2000, 0xdbf65d4d )
  646.     ROM_LOAD( "r3",           0x4000, 0x2000, 0xdb246fcd )
  647.     /* the diagnostics ROM would go here */
  648.  
  649.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  650.     ROM_LOAD( "gyrussk.1a",   0x0000, 0x2000, 0xf4ae1c17 )
  651.     ROM_LOAD( "gyrussk.2a",   0x2000, 0x2000, 0xba498115 )
  652.     /* the diagnostics ROM would go here */
  653.  
  654.     ROM_REGION( 0x1000, REGION_CPU3 )    /* 8039 */
  655.     ROM_LOAD( "gyrussk.3a",   0x0000, 0x1000, 0x3f9b5dea )
  656.  
  657.     ROM_REGION( 2*0x10000, REGION_CPU4 )    /* 64k for code + 64k for the decrypted opcodes */
  658.     ROM_LOAD( "gyrussk.9",    0xe000, 0x2000, 0x822bf27e )
  659.  
  660.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  661.     ROM_LOAD( "gyrussk.4",    0x0000, 0x2000, 0x27d8329b )
  662.  
  663.     ROM_REGION( 0x8000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  664.     ROM_LOAD( "gyrussk.6",    0x0000, 0x2000, 0xc949db10 )
  665.     ROM_LOAD( "gyrussk.5",    0x2000, 0x2000, 0x4f22411a )
  666.     ROM_LOAD( "gyrussk.8",    0x4000, 0x2000, 0x47cd1fbc )
  667.     ROM_LOAD( "gyrussk.7",    0x6000, 0x2000, 0x8e8d388c )
  668.  
  669.     ROM_REGION( 0x0220, REGION_PROMS )
  670.     ROM_LOAD( "gyrussk.pr3",  0x0000, 0x0020, 0x98782db3 )    /* palette */
  671.     ROM_LOAD( "gyrussk.pr1",  0x0020, 0x0100, 0x7ed057de )    /* sprite lookup table */
  672.     ROM_LOAD( "gyrussk.pr2",  0x0120, 0x0100, 0xde823a81 )    /* character lookup table */
  673. ROM_END
  674.  
  675.  
  676. static void init_gyruss(void)
  677. {
  678.     konami1_decode_cpu4();
  679. }
  680.  
  681.  
  682. GAME( 1983, gyruss,   0,      gyruss, gyruss,   gyruss, ROT90, "Konami", "Gyruss (Konami)" )
  683. GAME( 1983, gyrussce, gyruss, gyruss, gyrussce, gyruss, ROT90, "Konami (Centuri license)", "Gyruss (Centuri)" )
  684. GAME( 1983, venus,    gyruss, gyruss, gyrussce, gyruss, ROT90, "bootleg", "Venus" )
  685.